[ ! -d "${DISTPATH}"  ] && echo "Directory ${DISTPATH} DOES NOT exists." && exit || echo "yes"

GOVERSION=`go version`
CGO_ENABLED=0
GOOS=linux
GOARCH=amd64

LDFlags="
    -s -w
    -X 'github.com/xuelang-group/sh-solver-scheduler/cmd/solverscheduler/global.goVersion=${GOVERSION}' \
    -X 'github.com/xuelang-group/sh-solver-scheduler/cmd/solverscheduler/global.version=${APPVERSION}' \
    -X 'github.com/xuelang-group/sh-solver-scheduler/cmd/solverscheduler/global.gitCommit=${APPCOMMIT}' \
    -X 'github.com/xuelang-group/sh-solver-scheduler/cmd/solverscheduler/global.buildTime=${APPBUILDTIME}' \
"

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -ldflags="$LDFlags" -o $DISTPATH/solverscheduler cmd/solverscheduler/main.go

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o dist/solverscheduler cmd/solverscheduler/main.go